Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Log to workdir #28

Merged
merged 1 commit into from
Feb 4, 2022
Merged

Log to workdir #28

merged 1 commit into from
Feb 4, 2022

Conversation

cinek810
Copy link
Owner

@cinek810 cinek810 commented Feb 4, 2022

No description provided.

@cinek810 cinek810 force-pushed the log_to_workdir branch 5 times, most recently from dfe7ff3 to a654cb2 Compare February 4, 2022 14:53
@cinek810 cinek810 requested a review from LegenJCdary February 4, 2022 14:54
Copy link
Collaborator

@LegenJCdary LegenJCdary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor optimalization.

logger.addHandler(file_handler)
if log_dir:
if not os.path.exists(log_dir):
os.makedirs(log_dir)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.makedirs has a parameter: "exist_ok=bool" but I'm not sure what goes on low-level. In other case try/except would prolly be better.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well I'm not changing that, just moving things around :)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it sounds better since the old approach is vulnerable to TOCTOU race

@@ -30,7 +30,7 @@ check_run_ok() {
}

#Check wrong combinations
check_output_fail 'ansible-deploy' '\[ERROR\]: Too few arguments'
check_output_fail 'ansible-deploy' 'Too few arguments'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some new log-level for early significant errors e.g. fatal.
[FATAL]: Too few arguments!
;)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may make sense, if we use it in logger for all the errors where we exit, but... logging doesn't have it. It has a critical which sounds like somthing we should us for critical errors already - diferent issue.

@cinek810 cinek810 merged commit 26035ab into main Feb 4, 2022
@cinek810 cinek810 deleted the log_to_workdir branch February 4, 2022 16:12
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants